function openPriorityoptionsPopup(){
	jQuery('#basic-modal-content-priorityoption').modal();
}
function savePriorityoption(){
	if(validate()){
		if(jQuery('#priorityoption_id').val() == ""){
			jQuery.post("./admin/database_definition/priorityoptions/ajax_priorityoption_save", { priorityoption: jQuery("#priorityoption").val(), priorityprice: jQuery("#priorityprice").val(), priority_percentage: jQuery("#priority_percentage").val()},
				function(data) {
					res = eval('(' + data + ')');
					if(res.result){
						jQuery('#escort-option').tabs( "load" , 23 );
						jQuery.modal.close();
						jQuery('#content-body').prepend('<div class="alert success">'+ res.message+'</div>');
					}else{
						jQuery('form#add-priorityoption-form section.item').prepend('<div class="alert error">'+ res.message+'</div>');
					}
				}
			);
		}else{
			jQuery.post("./admin/database_definition/priorityoptions/ajax_priorityoption_update", {id: jQuery('#priorityoption_id').val(), priorityoption: jQuery("#priorityoption").val(), priorityprice: jQuery("#priorityprice").val(), priority_percentage: jQuery("#priority_percentage").val()},
				function(data) {
					res = eval('(' + data + ')');
					if(res.result){
						jQuery('#priorityoption_id').val("");
						jQuery("#priorityoption").val("");
						jQuery('#escort-option').tabs( "load" , 23 );
						jQuery.modal.close();
						jQuery('#content-body').prepend('<div class="alert success">'+ res.message+'</div>');
					}else{
						jQuery('form#add-priorityoption-form section.item').prepend('<div class="alert error">'+ res.message+'</div>');
					}
			 	}
			);
		}
	}else{
		return false;
	}
}
function validate(){
	return true;
}
function editPriorityoption(id){
	jQuery.post("./admin/database_definition/priorityoptions/ajax_priorityoption_get", { id: id},
		function(data) {
			res = data;
			jQuery('#basic-modal-content-priorityoption').modal();
			jQuery('#priorityoption').val(res.priority);
			jQuery('#priorityprice').val(res.price);
			jQuery('#priority_percentage').val(res.priority_percentage);
			jQuery('#priorityoption_id').val(res.id);
	 	}, 'json'
	);
	return false;
}
function deletePriorityoption(id, message){
	confirm(message, function () {
		jQuery.post("./admin/database_definition/priorityoptions/ajax_priorityoption_delete", { id: id},
			function(data) {
				jQuery('#escort-option').tabs( "load" , 23 );
		 	}
		);
		return false;
	});
	return false;
}